<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
<div id="updateDialog" class="crudDialog">
	<form id="updateForm" method="post">
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="name">设备类型</label>
						<input id="name" type="text" class="form-control" name="name" maxlength="500" value="${homeDeviceType.name}">
					</div>
				</div>
			</div>

			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type001">扩展1</label>
						<input id="type001" type="text" class="form-control" name="type001" maxlength="500" value="${homeDeviceType.type001}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type002">扩展2</label>
						<input id="type002" type="text" class="form-control" name="type002" maxlength="500" value="${homeDeviceType.type002}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type003">扩展3</label>
						<input id="type003" type="text" class="form-control" name="type003" maxlength="500" value="${homeDeviceType.type003}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type004">扩展4</label>
						<input id="type004" type="text" class="form-control" name="type004" maxlength="500" value="${homeDeviceType.type004}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type005">扩展5</label>
						<input id="type005" type="text" class="form-control" name="type005" maxlength="500" value="${homeDeviceType.type005}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type006">扩展6</label>
						<input id="type006" type="text" class="form-control" name="type006" maxlength="500" value="${homeDeviceType.type006}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type007">扩展7</label>
						<input id="type007" type="text" class="form-control" name="type007" maxlength="500" value="${homeDeviceType.type007}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type008">扩展8</label>
						<input id="type008" type="text" class="form-control" name="type008" maxlength="500" value="${homeDeviceType.type008}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type009">扩展9</label>
						<input id="type009" type="text" class="form-control" name="type009" maxlength="500" value="${homeDeviceType.type009}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type010">扩展10</label>
						<input id="type010" type="text" class="form-control" name="type010" maxlength="500" value="${homeDeviceType.type010}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type011">扩展11</label>
						<input id="type011" type="text" class="form-control" name="type011" maxlength="500" value="${homeDeviceType.type011}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type012">扩展12</label>
						<input id="type012" type="text" class="form-control" name="type012" maxlength="500" value="${homeDeviceType.type012}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type013">扩展13</label>
						<input id="type013" type="text" class="form-control" name="type013" maxlength="500" value="${homeDeviceType.type013}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type014">扩展14</label>
						<input id="type014" type="text" class="form-control" name="type014" maxlength="500" value="${homeDeviceType.type014}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type015">扩展15</label>
						<input id="type015" type="text" class="form-control" name="type015" maxlength="500" value="${homeDeviceType.type015}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type016">扩展16</label>
						<input id="type016" type="text" class="form-control" name="type016" maxlength="500" value="${homeDeviceType.type016}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type017">扩展17</label>
						<input id="type017" type="text" class="form-control" name="type017" maxlength="500" value="${homeDeviceType.type017}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type018">扩展18</label>
						<input id="type018" type="text" class="form-control" name="type018" maxlength="500" value="${homeDeviceType.type018}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type019">扩展19</label>
						<input id="type019" type="text" class="form-control" name="type019" maxlength="500" value="${homeDeviceType.type019}">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="type020">扩展20</label>
						<input id="type020" type="text" class="form-control" name="type020" maxlength="500" value="${homeDeviceType.type020}">
					</div>
				</div>
			</div>
		</div>

		<div class="form-group text-right dialog-buttons">
			<a class="waves-effect waves-button" href="javascript:;" onclick="updateSubmit();">保存</a>
			<a class="waves-effect waves-button" href="javascript:;" onclick="updateDialog.close();">取消</a>
		</div>
	</form>
</div>
<script>
    function updateSubmit() {
        $.ajax({
            type: 'post',
            url: '${basePath}/manage/devicetype/update/${homeDeviceType.id}',
            data: $('#updateForm').serialize(),
            beforeSend: function() {
                if ($('#name').val() == '') {
                    $('#name').focus();
                    return false;
                }
            },
            success: function(result) {
                if (result.code != 1) {
                    if (result.data instanceof Array) {
                        $.each(result.data, function(index, value) {
                            $.confirm({
                                theme: 'dark',
                                animation: 'rotateX',
                                closeAnimation: 'rotateX',
                                title: false,
                                content: value.errorMsg,
                                buttons: {
                                    confirm: {
                                        text: '确认',
                                        btnClass: 'waves-effect waves-button waves-light'
                                    }
                                }
                            });
                        });
                    } else {
                        $.confirm({
                            theme: 'dark',
                            animation: 'rotateX',
                            closeAnimation: 'rotateX',
                            title: false,
                            content: result.data.errorMsg,
                            buttons: {
                                confirm: {
                                    text: '确认',
                                    btnClass: 'waves-effect waves-button waves-light'
                                }
                            }
                        });
                    }
                } else {
                    updateDialog.close();
                    $table.bootstrapTable('refresh');
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                $.confirm({
                    theme: 'dark',
                    animation: 'rotateX',
                    closeAnimation: 'rotateX',
                    title: false,
                    content: textStatus,
                    buttons: {
                        confirm: {
                            text: '确认',
                            btnClass: 'waves-effect waves-button waves-light'
                        }
                    }
                });
            }
        });
    }
</script>